//
//  Emoticon.swift
//  SinaWebo
//
//  Created by mis on 16/3/23.
//  Copyright © 2016年 mis. All rights reserved.
//

import UIKit

class Emoticon: NSObject {
    /// 分组图片的文件夹名称
    var id: String?
    /// 图片的中文名称
    var chs: String?
    /// 表情图片
    var png: String?
    
    var imagePath: String? {
        if let idName = id, pngName = png {
            let path = NSBundle.mainBundle().bundlePath + "/Emoticons.bundle/" + "\(idName)/" + pngName
            return path
        }
        return nil
    }
    /// emoji表情的16进制字符串
    var code: String?
    
    var emojiStr: String? {
        if let codeStr = code {
            return codeStr.emojiString
        }
        return nil
    }
    
    var isRemove = false
    var isEmpty = false
    
    init(isRemove: Bool) {
        self.isRemove = isRemove
        super.init()
    }
    
    init(isEmpty: Bool) {
        self.isEmpty = isEmpty
        super.init()
    }
    
    init(id: String, dict: [String: String]) {
        self.id = id
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) { }
    
    override var description: String {
        let key = ["code","chs","png"]
        return dictionaryWithValuesForKeys(key).description
    }
}
